//
//  LocalCacheHandler.h
//  CToolBox
//
//  Created by SC on 16/12/12.
//  Copyright © 2016年 SC. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "FMDatabase.h"
#import <FMDatabaseQueue.h>

typedef NS_ENUM(NSUInteger,CacheTime) {
    CacheMinute = 60,
    CacheHour = CacheMinute *60
    
};


/**
 *  缓存
 */
@interface LocalCacheHandler : NSObject{
//    FMDatabase *_db;
    FMDatabaseQueue *_queue;
}

/**
 *  单例方法
 *
 *  @return myFMDB
 */
+ (LocalCacheHandler *)shareInstanceMethod;

/**
 *  保存或者更新
 *
 *  @param key            key
 *  @param dic            数据
 *  @param expireLength   过期时长
 */
- (void)saveOrUpdateWithKey:(NSString *)key dic:(NSDictionary *)dic expireLength:(long)expireLength;

/**
 *  查询
 *
 *  @param key      key
 *  @param complete 回调block
 */
- (void)getValueWithKey:(NSString *)key complete:(void(^)(BOOL isExpired,id object))complete;

/**
 *  清空表
 *
 */
- (void)clearTable;

/**
 * 删除表
 */
- (void)deleteTable;


/**
 重新设置缓存时间

 */
- (void)resetExpireLength:(long)expireLength key:(NSString *)key;

@end
